package acwing.双指针;

import java.io.*;


/**
 * 完全二叉树的权值
 *
 * @author yang
 * @date 2021/12/8
 */
public class 完全二叉树的权值 {

    static int n,N=100010;
    static int[] a=new int[N];
    static BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
    static public void main(String[] args) throws IOException {
        n=Integer.parseInt(in.readLine());
        String[] num=in.readLine().split(" ");
        for(int i=1;i<=n;i++)
            a[i]=Integer.parseInt(num[i-1]);
        int cnt=1;
        long max=Integer.MIN_VALUE;
        for(int d=1,i=1;i<=n;i*=2,d++){
            long sum=0L;
            // (1<<d-1) == 2的d-1次方
            for(int j=i;j<i+(1<<d-1) && j<=n;j++)
                sum+=a[j];

            if(sum>max){
                max=sum;
                cnt=d;
            }
        }
        System.out.println(cnt);

    }
}
